﻿using System;
using MyWeb.Business;

namespace MyWeb.Controls
{
    public partial class banner2 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                ShowLeft();
                ShowRight();
            }
        }
        private void ShowLeft()
        {
            var s = "";
            var list = AdvertiseService.Advertise_GetByTop("1", "Active = '1' and Position = '5'", "");
            if(list.Count > 0)
            {
                s += "<div class=\"banner-side-left\">";
                foreach (var t in list)
                {
                    s += "<a href=\"" + t.Link + "\" title='" + t.Name + "' target='" + t.Target + "'>";
                    s += "<img class=\"lazy\" src='" + t.Images + "' data-original='" + t.Images + "' alt='" + t.Name + "' />";
                    s += "</a>";
                }
                s += "</div>";
                ltrleft.Text = s;
            }
            #region html code
            /*
                <div class="banner-side-left">
                <a href="#" title="" target="_blank">
                    <img class="lazy" src="http://www.mediamart.vn/Images/Banner/ben_phai-2282013103418am.jpg"
                        data-original="http://www.mediamart.vn/Images/Banner/ben_phai-2282013103418am.jpg"
                        alt="" />
                </a>
            </div>
             */
            #endregion
        }
        private void ShowRight()
        {
            var s = "";
            var list = AdvertiseService.Advertise_GetByTop("1", "Active = '1' and Position = '6'", "");
            if (list.Count > 0)
            {
                s += "<div class=\"banner-side-right\">";
                foreach (var t in list)
                {
                    s += "<a href=\"" + t.Link + "\" title='" + t.Name + "' target='" + t.Target + "'>";
                    s += "<img class=\"lazy\" src='" + t.Images + "' data-original='" + t.Images + "' alt='" + t.Name + "' />";
                    s += "</a>";
                }
                s += "</div>";
                ltrright.Text = s;
            }
            #region html code
            /*
             <div class="banner-side-right">
                <a href="#" title="" target="_blank">
                    <img class="lazy" src="http://www.mediamart.vn/Images/Banner/tvlcda-31201315817am.jpg"
                        data-original="http://www.mediamart.vn/Images/Banner/tvlcda-31201315817am.jpg"
                        alt="" />
                </a>
            </div>
             */
            #endregion
        }
    }
}